<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>管理后台</title>
    <link rel="shortcut icon" href="/favicon.ico">
    <link href="/public/admin/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="/public/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/public/admin/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="/public/admin/css/animate.css" rel="stylesheet">
    <link href="/public/admin/css/style.css?v=4.0.0" rel="stylesheet">
    <link href="/public/admin/js/plugins/layer/skin/layer.css" rel="stylesheet">
    <base target="_blank">
    <!-- 全局js -->
    <script src="/public/admin/js/jquery.min.js?v=2.1.4"></script>
    <script src="/public/admin/js/bootstrap.min.js?v=3.3.5"></script>
    <script src="/public/admin/js/plugins/layer/layer.min.js"></script>
    <!-- 自定义js -->
    <script src="/public/admin/js/content.js?v=1.0.0"></script>
    <script src="/public/admin/js/contabs.js"></script>
    <script src="/public/admin/js/common.js"></script>
    <script src="/public/admin/js/article.js"></script>

    <!-- Bootstrap table -->
    <script src="/public/admin/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
    <script src="/public/admin/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
    <script src="/public/admin/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-xs-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>信息列表</h5>
                </div>
                <div class="ibox-content">
                    <div class="box-header">
                        <div class="panel-body">
                            <form action="" id="search-form2" class="form-inline" method="get" action="{:url('user/index')}" target="_self">
                                <label class="control-label" for="input-patient_name">病人姓名</label>
                                <div class="input-group" style="width:100px;">
                                    <input type="text" name="patient_name" value="{$inputData['patient_name']}" placeholder="姓名" id="input-patient_name" class="form-control">
                                </div>
                                <label class="control-label" for="input-patient">记账号</label>
                                <div class="input-group" style="width:100px;">
                                    <input type="text" name="patient" value="{$inputData['patient']}" placeholder="记账号" id="input-patient" class="form-control">
                                </div>
                                <label class="control-label" for="input-patient">科室代码</label>
                                <div class="input-group" style="width:100px;">
                                    <input type="text" name="department_code" value="{$inputData['department_code']}" placeholder="科室代码" id="input-department_code" class="form-control">
                                </div>
                                <label class="control-label" for="input-patient">RFID号码</label>
                                <div class="input-group">
                                    <input type="text" name="rfid" value="{$inputData['rfid']}" placeholder="RFID号码" id="input-rfid" class="form-control">
                                </div>
                                
                               <!--  <b>是否告警：</b>
                                <select class="form-control" name="iswarn">
                                    <option value="">全部</option>
                                    <option value="1">是</option>
                                    <option value="0">否</option>
                                </select> -->
                                <button type="submit" id="button-filter search-order" class="btn btn-primary" id="fileForm"><i class="fa fa-search"></i> 筛选</button>

                                <!-- <button onclick="window.location.href=location.href;"  class="btn btn-primary pull-left "><i class="glyphicon glyphicon-refresh" target="_self"></i>刷新</button> -->
                                <!-- <button onclick="window.location.href=location.href;"  class="btn btn-primary pull-right "><i class="glyphicon glyphicon-refresh" target="_self"></i>同步所有信息</button> -->
                                <!-- <a onclick="openYemian('/index.php/Admin/patient/mainEdit','添加成员')" href="javascript:;" class="btn btn-primary pull-right" target="_self" style="margin-right:10px;"><i class="fa fa-plus"></i>新增</a> -->

                            </form>
                            <script>
                                var requestcode=1;
                                function importExcel(){
                                    if(requestcode != 1){
                                        layer.msg('提交请求中，请稍候');
                                        return false;
                                    }
                                    var formData = new FormData($('#search-form2')[0]);
                                        formData.append('file',$('#excelfile')[0].files[0]);
                                    $.ajax({
                                        type:'post',
                                        url:"{:url('user/importExcel')}",
                                        cache: false,
                                        processData: false,
                                        contentType: false,
                                        async: false,
                                        data:formData,
                                        dataType:'json',
                                        success:function(res){
                                            if(res.status==1){
                                                layer.msg(res.msg,{time:1000},function(){
                                                    window.location = window.location;
                                                })
                                            }else{
                                                layer.msg(res.msg);
                                            }
                                            setTimeout(function(){
                                                requestcode = 1;
                                            },500);
                                        }

                                    });
                                    requestcode = 0;
                                    return false;
                                }
                            </script>
                        </div>
                        <div id="ajax_return">

                            <form method="post" enctype="multipart/form-data" target="_blank" id="form-order">
                                <div class="table-responsive">
                                    <table class="table table-bordered table-hover">
                                        <thead>
                                        <tr>
                                            <!-- <th style="width: 1px;display:none"><input type="checkbox" onclick="$('input[name*=\'selected\']').prop('checked', this.checked);"></th> -->
                                            <th>ID</th>
                                            <th>记账号</th>
                                            <th>病人姓名</th>
                                            <th>性别</th>
                                            <th>年龄</th>
                                            <th>RFID号码</th>
                                            <th>科室名称</th>
                                            <th>区域</th>
                                            <th>设备码</th>
                                            <th>强度</th>
                                            <!-- <th>是否告警</th> -->
                                            <th>签到时间</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        {volist name="list" id="v"}
                                            <tr>
                                                <td>{$v.id}</td>
                                                <td>{$v.patient_id}</td>
                                                <td>{$v.patient_name}</td>
                                                <td>{eq name="v.gender" value="1"}男{else/}女{/eq}</td>
                                                <td>{$v.age}</td>
                                                <td>{$v.rfid}</td>
                                                <td>{$v.department}</td>
                                                <td>{$v.location}</td>
                                                <td>{$v.addr}</td>
                                                <td>{$v.qd}</td>
                                                <!-- <td>{eq name="v.iswarn" value="1"}<font color="red">是</font>{else/}否{/eq}</td> -->
                                                <td>{$v.createtime|date="Y-m-d H:i:s"}</td>
                                            </tr>
                                        {/volist}
                                        </tbody>
                                    </table>
                                </div>
                            </form>
                            <div class="row">
                                <!-- <div class="col-sm-6 text-left" style="display:none"><a href="javascript:void(0);" onclick="delselect()" id="button-delete6" data-toggle="tooltip" title="删除" class="btn btn-danger" data-original-title="删除">删除选中</a></div> -->
                                <div class="col-sm-6 text-right">{$page|raw}</div>
                            </div>
                        <script>
                            // 点击分页触发的事件
                            // $(".pagination a").click(function(){
                            //     url = $(this).attr('href');
                            //     ajax_get_url('search-form2',url);
                            //     return false;
                            // });
                            // 删除选中
                            function delselect(){
                                parent.layer.confirm('确定要删除选中吗？', function(){
                                    $.ajax({
                                        url:"/index.php/Admin/patient/delselect",
                                        data : $('#form-order').serialize(),
                                        success: function(v){
                                            var v =  eval('('+v+')');
                                            parent.layer.msg(v.msg, {icon: v.icon,time: 1000});
                                            if(v.hasOwnProperty('status') && (v.status == 1))
                                                ajax_get_table('search-form2',cur_page);
                                        }
                                    });
                                });
                            }
                            //
                        </script>

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

</div>
<input id="handle_status" value="" hidden="hidden">

<script>
// 添加菜单
    function add(obj){
        var dataId  = $(obj).attr('dataId');
        $("input[name='patient_id']").val(dataId);
        $('#bjy-add').modal('show');
    }
    // $(document).ready(function(){
    //     ajax_get_table('search-form2',1);
    // });

    function openLayer(url,name){
        parent.layer.open({
            type: 2,
            title: name,
            shade: 0.5,
            shadeClose : false,
            maxmin: true, //开启最大化最小化按钮
            area: ['70%', '80%'],
            content: url,
            end : function(){
                var handle_status = $("#handle_status").val();
                if(handle_status == '1'){
                    window.location.href = location.href;
                }
            }
        });
    }


    // 删除操作
    function del(id,obj) {
        top.layer.confirm('确定删除该账号？',{
            icon : 3,
            btn:['确定','取消'],
        } , function(){
            $.ajax({
                url :'/index.php/Admin/Patient/mainDel',
                type : "post",
                data : {id:id},
                dataType : "json",
                success:function(data){
                    if (data.status == 0) {
                        top.layer.msg(data.message);
                    } else {
                        top.layer.msg(data.message);
                        $(obj).parent().parent().remove();
                        var total = $("#total").html()-1;
                        $("#total").html(total);
                    }
                }
            });
        } , function(){
            layer.close(); //再执行关闭
        })
    }


    // 点击排序
    function sort(field){
        $("input[name='order_by']").val(field);
        var v = $("input[name='sort']").val() == 'desc' ? 'asc' : 'desc';
        $("input[name='sort']").val(v);
        ajax_get_table('search-form2',cur_page);
    }

    setTimeout(function(){
        window.location.href = location.href;
    },15000);
    
</script>
</body>
</html>